<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<span id="spanId">Hello Span</span> <br>
<button onclick="clickMe()">点击</button>

<script>
    function clickMe() {
        var spanObj = document.getElementById('spanId');
        //spanObj.innerText = '<h1 style="color: red">innerText</h1>';
        spanObj.innerHTML = '<h1 style="color: red">innerText</h1>';
    }
</script>
</body>
</html>